<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <form id="my-form" class="am-form tpl-form-line-form" method="post">
                    <div class="widget-body">
                        <fieldset>
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl">分享设置</div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">首页分享图 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <div class="am-form-file">
                                        <div class="am-form-file">
                                            <button type="button"
                                                    id="upload-index-file"
                                                    class="upload-file am-btn am-btn-secondary am-radius">
                                                <i class="am-icon-cloud-upload"></i> 选择图片
                                            </button>
                                            <div class="uploader-list am-cf">
                                                <?php if (!empty($values['index']['image_url'])):  ?>
                                                    <div class="file-item">
                                                        <a href="<?= $values['index']['image_url'] ?>" title="点击查看大图"
                                                           target="_blank">
                                                            <img src="<?= $values['index']['image_url'] ?>">
                                                        </a>
                                                        <input type="hidden" name="share[index][image_url]"
                                                               value="<?= $values['index']['image_url'] ?>">
                                                        <i class="iconfont icon-shanchu file-item-delete"></i>
                                                    </div>
                                                <?php else: ?>
                                                    <input type="hidden" name="share[index][image_url]"
                                                           value="">
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">列表页分享图 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <div class="am-form-file">
                                        <div class="am-form-file">
                                            <button type="button"
                                                    id="upload-list-file"
                                                    class="upload-file am-btn am-btn-secondary am-radius">
                                                <i class="am-icon-cloud-upload"></i> 选择图片
                                            </button>
                                            <div class="uploader-list am-cf">
                                                <?php if (!empty($values['list']['image_url'])):  ?>
                                                    <div class="file-item">
                                                        <a href="<?= $values['list']['image_url'] ?>" title="点击查看大图"
                                                           target="_blank">
                                                            <img src="<?= $values['list']['image_url'] ?>">
                                                        </a>
                                                        <input type="hidden" name="share[list][image_url]"
                                                               value="<?= $values['list']['image_url'] ?>">
                                                        <i class="iconfont icon-shanchu file-item-delete"></i>
                                                    </div>
                                                <?php else: ?>
                                                    <input type="hidden" name="share[list][image_url]"
                                                           value="">
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">详情页分享图 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <div class="am-form-file">
                                        <div class="am-form-file">
                                            <button type="button"
                                                    id="upload-detail-file"
                                                    class="upload-file am-btn am-btn-secondary am-radius">
                                                <i class="am-icon-cloud-upload"></i> 选择图片
                                            </button>
                                            <div class="uploader-list am-cf">
                                                <?php if (!empty($values['detail']['image_url'])):  ?>
                                                    <div class="file-item">
                                                        <a href="<?= $values['detail']['image_url'] ?>" title="点击查看大图"
                                                           target="_blank">
                                                            <img src="<?= $values['detail']['image_url'] ?>">
                                                        </a>
                                                        <input type="hidden" name="share[detail][image_url]"
                                                               value="<?= $values['detail']['image_url'] ?>">
                                                        <i class="iconfont icon-shanchu file-item-delete"></i>
                                                    </div>
                                                <?php else: ?>
                                                    <input type="hidden" name="share[detail][image_url]"
                                                           value="">
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">积分商城分享图 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <div class="am-form-file">
                                        <div class="am-form-file">
                                            <button type="button"
                                                    id="upload-points-file"
                                                    class="upload-file am-btn am-btn-secondary am-radius">
                                                <i class="am-icon-cloud-upload"></i> 选择图片
                                            </button>
                                            <div class="uploader-list am-cf">
                                                <?php if (!empty($values['points']['image_url'])):  ?>
                                                    <div class="file-item">
                                                        <a href="<?= $values['points']['image_url'] ?>" title="点击查看大图"
                                                           target="_blank">
                                                            <img src="<?= $values['points']['image_url'] ?>">
                                                        </a>
                                                        <input type="hidden" name="share[points][image_url]"
                                                               value="<?= $values['points']['image_url'] ?>">
                                                        <i class="iconfont icon-shanchu file-item-delete"></i>
                                                    </div>
                                                <?php else: ?>
                                                    <input type="hidden" name="share[points][image_url]"
                                                           value="">
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">积分商城详情页 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <div class="am-form-file">
                                        <div class="am-form-file">
                                            <button type="button"
                                                    id="upload-points-detail-file"
                                                    class="upload-file am-btn am-btn-secondary am-radius">
                                                <i class="am-icon-cloud-upload"></i> 选择图片
                                            </button>
                                            <div class="uploader-list am-cf">
                                                <?php if (!empty($values['points_detail']['image_url'])):  ?>
                                                    <div class="file-item">
                                                        <a href="<?= $values['points_detail']['image_url'] ?>" title="点击查看大图"
                                                           target="_blank">
                                                            <img src="<?= $values['points_detail']['image_url'] ?>">
                                                        </a>
                                                        <input type="hidden" name="share[points_detail][image_url]"
                                                               value="<?= $values['points_detail']['image_url'] ?>">
                                                        <i class="iconfont icon-shanchu file-item-delete"></i>
                                                    </div>
                                                <?php else: ?>
                                                    <input type="hidden" name="share[points_detail][image_url]"
                                                           value="">
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">综合首页 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <div class="am-form-file">
                                        <div class="am-form-file">
                                            <button type="button"
                                                    id="upload-article-file"
                                                    class="upload-file am-btn am-btn-secondary am-radius">
                                                <i class="am-icon-cloud-upload"></i> 选择图片
                                            </button>
                                            <div class="uploader-list am-cf">
                                                <?php if (!empty($values['article']['image_url'])):  ?>
                                                    <div class="file-item">
                                                        <a href="<?= $values['article']['image_url'] ?>" title="点击查看大图"
                                                           target="_blank">
                                                            <img src="<?= $values['article']['image_url'] ?>">
                                                        </a>
                                                        <input type="hidden" name="share[article][image_url]"
                                                               value="<?= $values['article']['image_url'] ?>">
                                                        <i class="iconfont icon-shanchu file-item-delete"></i>
                                                    </div>
                                                <?php else: ?>
                                                    <input type="hidden" name="share[article][image_url]"
                                                           value="">
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">综合详情 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <div class="am-form-file">
                                        <div class="am-form-file">
                                            <button type="button"
                                                    id="upload-article-detail-file"
                                                    class="upload-file am-btn am-btn-secondary am-radius">
                                                <i class="am-icon-cloud-upload"></i> 选择图片
                                            </button>
                                            <div class="uploader-list am-cf">
                                                <?php if (!empty($values['article_detail']['image_url'])):  ?>
                                                    <div class="file-item">
                                                        <a href="<?= $values['article_detail']['image_url'] ?>" title="点击查看大图"
                                                           target="_blank">
                                                            <img src="<?= $values['article_detail']['image_url'] ?>">
                                                        </a>
                                                        <input type="hidden" name="share[article_detail][image_url]"
                                                               value="<?= $values['article_detail']['image_url'] ?>">
                                                        <i class="iconfont icon-shanchu file-item-delete"></i>
                                                    </div>
                                                <?php else: ?>
                                                    <input type="hidden" name="share[article_detail][image_url]"
                                                           value="">
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">综合列表 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <div class="am-form-file">
                                        <div class="am-form-file">
                                            <button type="button"
                                                    id="upload-article-list-file"
                                                    class="upload-file am-btn am-btn-secondary am-radius">
                                                <i class="am-icon-cloud-upload"></i> 选择图片
                                            </button>
                                            <div class="uploader-list am-cf">
                                                <?php if (!empty($values['article_list']['image_url'])):  ?>
                                                    <div class="file-item">
                                                        <a href="<?= $values['article_list']['image_url'] ?>" title="点击查看大图"
                                                           target="_blank">
                                                            <img src="<?= $values['article_list']['image_url'] ?>">
                                                        </a>
                                                        <input type="hidden" name="share[article_list][image_url]"
                                                               value="<?= $values['article_list']['image_url'] ?>">
                                                        <i class="iconfont icon-shanchu file-item-delete"></i>
                                                    </div>
                                                <?php else: ?>
                                                    <input type="hidden" name="share[article_list][image_url]"
                                                           value="">
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">单页设置 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <div class="am-form-file">
                                        <div class="am-form-file">
                                            <button type="button"
                                                    id="upload-about-file"
                                                    class="upload-file am-btn am-btn-secondary am-radius">
                                                <i class="am-icon-cloud-upload"></i> 选择图片
                                            </button>
                                            <div class="uploader-list am-cf">
                                                <?php if (!empty($values['about']['image_url'])):  ?>
                                                    <div class="file-item">
                                                        <a href="<?= $values['about']['image_url'] ?>" title="点击查看大图"
                                                           target="_blank">
                                                            <img src="<?= $values['about']['image_url'] ?>">
                                                        </a>
                                                        <input type="hidden" name="share[about][image_url]"
                                                               value="<?= $values['about']['image_url'] ?>">
                                                        <i class="iconfont icon-shanchu file-item-delete"></i>
                                                    </div>
                                                <?php else: ?>
                                                    <input type="hidden" name="share[about][image_url]"
                                                           value="">
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="am-form-group">
                                <div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
                                    <button type="submit" class="j-submit am-btn am-btn-secondary">提交
                                    </button>
                                </div>
                            </div>
                        </fieldset>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<!-- 图片文件列表模板 -->
<script id="tpl-file-item" type="text/template">
    {{ each list }}
    <div class="file-item">
        <a href="{{ $value.file_path }}" title="点击查看大图" target="_blank">
            <img src="{{ $value.file_path }}">
        </a>
        <input type="hidden" name="{{ name }}" value="{{ $value.file_path }}">
        <i class="iconfont icon-shanchu file-item-delete"></i>
    </div>
    {{ /each }}
</script>
<!-- 文件库弹窗 -->
{{include file="layouts/_template/file_library" /}}
<script>
    $(function () {
        // 选择图片
        $('#upload-index-file').selectImages({
            name: 'share[index][image_url]'
        });
        //选择列表页图片
        $('#upload-list-file').selectImages({
            name: 'share[list][image_url]'
        });
        //选择详情页图片
        $('#upload-detail-file').selectImages({
            name: 'share[detail][image_url]'
        });
        //选择积分商城首页图片
        $('#upload-points-file').selectImages({
            name: 'share[points][image_url]'
        });
        //选择积分商城详情页
        $('#upload-points-detail-file').selectImages({
            name: 'share[points_detail][image_url]'
        });
        //综合首页
        $('#upload-article-file').selectImages({
            name: 'share[article][image_url]'
        });
        //综合详情页
        $('#upload-article-detail-file').selectImages({
            name: 'share[article_detail][image_url]'
        });
        //综合列表页
        $('#upload-article-list-file').selectImages({
            name: 'share[article_list][image_url]'
        });
        //单页
        $('#upload-about-file').selectImages({
            name: 'share[about][image_url]'
        });

        /**
         * 表单验证提交
         * @type {*}
         */
        $('#my-form').superForm();

    });
</script>
